<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="../templates/TemplatePrincipal.xhtml">
        
        <ui:define name="top">
         
        </ui:define>
        <ui:define name="content">
            <h:form styleClass="jsfcrud_list_form">
                <h:panelGroup id="messagePanel" layout="block">
                    <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                </h:panelGroup>
                <h:outputText escape="false" value="Nenhuma locação encontrada" rendered="#{locacaoController.items.rowCount == 0}"/>
                <h:panelGroup rendered="#{locacaoController.items.rowCount > 0}">
                    <h:outputText value="#{locacaoController.pagination.pageFirstItem + 1}..#{locacaoController.pagination.pageLastItem + 1}/#{locacaoController.pagination.itemsCount}"/>&nbsp;
                    <h:commandLink action="#{locacaoController.previous}" value="Anterior #{locacaoController.pagination.pageSize}" rendered="#{locacaoController.pagination.hasPreviousPage}"/>&nbsp;
                    <h:commandLink action="#{locacaoController.next}" value="Proxima #{locacaoController.pagination.pageSize}" rendered="#{locacaoController.pagination.hasNextPage}"/>&nbsp;
                    <p:dataTable value="#{locacaoController.items}" var="item">
                        <p:column headerText="Id">                   
                            <h:outputText value="#{item.idLocacao}"/>
                        </p:column>
                        <p:column headerText="Data">                      
                            <h:outputText value="#{item.data}">
                                <f:convertDateTime pattern="MM/dd/yyyy" />
                            </h:outputText>
                        </p:column>
                        <p:column headerText="Cliente">
                            <h:outputText value="#{item.clienteIdPessoa}"/>
                        </p:column>
                        <p:column>
                            <h:outputText value="#{item.filme}"/>
                        </p:column>
                        <p:column headerText="Ações">
                            <h:commandLink action="#{locacaoController.prepareView}" value="#{mensagens.ListLocacaoViewLink}"/>
                            <h:outputText value=" "/>
                            <h:commandLink action="#{locacaoController.prepareEdit}" value="#{mensagens.ListLocacaoEditLink}"/>
                            <h:outputText value=" "/>
                            <h:commandLink action="#{locacaoController.destroy}" value="#{mensagens.ListLocacaoDestroyLink}"/>
                        </p:column>
                    </p:dataTable>
                </h:panelGroup>
                <br />
                <h:commandButton action="#{locacaoController.prepareCreate}" value="Concluir"/>
            
               
            </h:form>
        </ui:define>
        <ui:define name="bottom">
            
        </ui:define>
    </ui:composition>

</html>
